package com.x.wx.service;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import com.x.wx.dao.WxAccountDao;
import com.x.wx.dao.WxKeywordDao;
import com.x.wx.model.WxAccount;
import com.x.wx.model.WxKeyword;
import com.x.wx.rpc.WxAccountRpcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * Created by Administrator on 2018/3/6.
 */

@Component
@Service(interfaceName = "com.x.wx.rpc.WxAccountRpcService", timeout = 10000)
public class WxAccountService extends BaseService implements WxAccountRpcService {

	@Autowired
	private WxAccountDao wxAccountDao;

	public WxAccount insertWxAccount(WxAccount wxAccount) {
		try {
			return this.insert(wxAccount);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	public List<WxAccount> selectWxAccountList(WxAccount wxAccount) {
		try {
			return  wxAccountDao.selectWxAccountList(wxAccount);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	public int selectWxAccountNum(WxAccount wxAccount) {
		try {
			return  wxAccountDao.selectWxAccountNum(wxAccount);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	public int  updateWxAccount(WxAccount wxAccount) {
		try {
			return this.update(wxAccount);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	public WxAccount selectWxAccountById(WxAccount wxAccount) {
		try {
			return wxAccountDao.selectWxAccountById(wxAccount);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}
}
